home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / ab20 / unarced / utilities / system / intuition / shadow / docs / shadowlibfuncs.doc < prev    next >
Encoding:
Text File  |  1995-03-17  |  12.2 KB  |  441 lines

  1.                          Shadow.lib  Documentation
  2.                             Library Version 4.6
  3.  
  4.                               By David Navas
  5.                          Updated:  05 Feb 1992
  6.  
  7.                       Copyright © 1992 by David Navas
  8.                             All Rights Reserved
  9.  
  10. All functions except for SPrintfCallback take their arguments on the
  11. stack.
  12.  
  13. NAME
  14.       CreateInstance -- Creates in instance of a class.
  15.  
  16. SYNOPSIS
  17.       object = CreateInstance( pClass, className, metaName, ..., METHOD_END)
  18.         d0                                           < args on stack >
  19.  
  20. FUNCTION
  21.       Creates an instance of the described class.  Classes may be either
  22.       a private class, a public class, or a public meta.  If pClass is
  23.       non-NULL, then that class is used to create the instance.  If
  24.       metaName is NULL, then the className is used as a name for the
  25.       meta stored on the ShadowBase->sb_metaTree (which is what will be
  26.       used to create the instance).  Otherwise the metaName is used as
  27.       the name of the meta and className is used as the name for a class
  28.       on the meta's ATTR_OBJECTLIST tree which is the class that it will
  29.       use to create the instance.
  30.  
  31.       The arguments are the arguments that are passed to the
  32.       METHOD_META_INIT method of the object that is created.
  33.  
  34.       Complicated?
  35.  
  36.       Three possibilities:
  37.          CreateInstance(myPrivateClass, NULL, NULL, lots-of-args,
  38.                                                     METHOD_END);
  39.             - creates instance of myPrivateClass
  40.  
  41.          CreateInstance(NULL, METACLASS, NULL, lots-of-args, METHOD_END);
  42.  
  43.             - creates a Class whose class is METACLASS
  44.  
  45.          CreateInstance(NULL, ROOTCLASS, METACLASS, lots-f-args,
  46.                                                     METHOD_END);
  47.             - creates an instance of ROOTCLASS, where ROOTCLASS is a class
  48.               found in the METACLASS' ATTR_OBJECTLIST.
  49.  
  50.  
  51. INPUTS
  52.       META        pClass; - a pointer to the private class that you want
  53.                              an instance of.  If NULL, then use the
  54.                              className and metaName to find a public class.
  55.       char    *className; - the name of the public class.
  56.       char     *metaName; - the name of the public meta that the class can
  57.                              be found in.  If NULL, then the className is
  58.                              treated as the name of a public meta that you
  59.                              want an instance of.
  60.       .
  61.       .  <--- other arguments
  62.       .
  63.  
  64. OUTPUTS
  65.       void       *object; - the instance, or the return value from the
  66.                              METHOD_META_INIT of the particular class.
  67.                              As the programmer, you may want to change
  68.                              what that method returns.  For all included
  69.                              classes, the METHOD_META_INIT returns the
  70.                              object.
  71.                             NULL if error (for instance, class could not
  72.                              be found).
  73.  
  74. RESULT
  75.       A new Instance is formed.
  76.  
  77. BUGS
  78.       none known.
  79.  
  80. NOTES
  81.  
  82. SEE ALSO
  83.       METHOD_META_CREATE method in ShadowLibraryMethods.doc
  84.       CreateSubClass()
  85.       RemoveObject()
  86.  
  87. NAME
  88.       CreateSubClass -- Creates a sub-class of a class.
  89.  
  90. SYNOPSIS
  91.       object = CreateSubClass( pClass, className, metaName, ..., METHOD_END)
  92.         d0                                           < args on stack >
  93.  
  94. FUNCTION
  95.       Creates a subclass of the described class.  Classes may be either
  96.       a private class, a public class, or a public meta.  If pClass is
  97.       non-NULL, then that class is used to create the subclass.  If
  98.       metaName is NULL, then the className is used as a name for the
  99.       meta stored on the ShadowBase->sb_metaTree (which is what will be
  100.       used to create the submeta).  Otherwise the metaName is used as
  101.       the name of the meta and className is used as the name for a class
  102.       on the meta's ATTR_OBJECTLIST tree which is the class that it will
  103.       use to create the subclass.
  104.  
  105.       The arguments are the arguments that are passed to the
  106.       METHOD_META_SUB method of the class that is being sub-classed.
  107.  
  108.       Complicated?
  109.  
  110.       Three possibilities:
  111.          CreateSubClass(myPrivateClass, NULL, NULL, lots-of-args,
  112.                                                     METHOD_END);
  113.             - creates subclass of myPrivateClass
  114.  
  115.          CreateSubClass(NULL, METACLASS, NULL, lots-of-args, METHOD_END);
  116.  
  117.             - creates a Meta as a submeta of METACLASS
  118.  
  119.          CreateSubClass(NULL, ROOTCLASS, METACLASS, lots-f-args,
  120.                                                     METHOD_END);
  121.             - creates a subclass of ROOTCLASS, where ROOTCLASS is a class
  122.               found in the METACLASS' ATTR_OBJECTLIST.
  123.  
  124.  
  125. INPUTS
  126.       META        pClass; - a pointer to the private class that you want
  127.                              a subclass of.  If NULL, then use the
  128.                              className and metaName to find a public class.
  129.       char    *className; - the name of the public class.
  130.       char     *metaName; - the name of the public meta that the class can
  131.                              be found in.  If NULL, then the className is
  132.                              treated as the name of a public meta that you
  133.                              want a subclass of.
  134.       .
  135.       .  <--- other arguments
  136.       .
  137.  
  138. OUTPUTS
  139.       void       *object; - the subclass, or the return value from the
  140.                              METHOD_META_SUB of the particular class.
  141.                              As the programmer, you may want to change
  142.                              what that method returns.  For all included
  143.                              classes, the METHOD_META_SUB returns the
  144.                              class.
  145.                             NULL if error (for instance, class could not
  146.                              be found).
  147.  
  148. RESULT
  149.       A new subclass is formed.
  150.  
  151. BUGS
  152.       none known.
  153.  
  154. NOTES
  155.  
  156. SEE ALSO
  157.       METHOD_META_SUB method in ShadowLibraryMethods.doc
  158.       CreateInstance()
  159.       RemoveObject()
  160.  
  161. NAME
  162.       DoJazzMethod -- Front-end to DJM()  [shadow.lib]
  163.  
  164. SYNOPSIS
  165.       result = DoJazzMethod( object, class, method, ..., METHOD_END)
  166.         d0                           < args on stack >
  167.  
  168. FUNCTION
  169.       This function is the front-end to DJM().
  170.  
  171.       It checks for a valid object, and returns NULL if none.
  172.       If there is no valid class, class is set to object->cob_class.
  173.  
  174.       Then, DJM() is called via:  DJM(&object, SHADOW_MSG_FINDMETHOD)
  175.  
  176.  
  177. INPUTS
  178.       OBJECT             object; - the object to send the method to.
  179.                                     If NULL, function returns NULL
  180.       META                class; - the first "class" to check for the
  181.                                     method.  This allows you to send
  182.                                     a method to the superClass...
  183.                                     if NULL, class is set to
  184.                                      object->cob_class.
  185.       char              *method; - pointer to the method string.
  186.       .
  187.       .  <--- other arguments
  188.       .
  189.  
  190. OUTPUTS
  191.       void *result; - result from DJM()
  192.  
  193.  
  194. RESULT
  195.  
  196. BUGS
  197.       none known.
  198.  
  199. NOTES
  200.  
  201. SEE ALSO
  202.       DJM()
  203.  
  204. NAME
  205.       GetObject -- Semaphored access to an object in a public area.
  206.  
  207. SYNOPSIS
  208.       object = GetObject( OBJECT *objectPtr )
  209.         d0
  210.  
  211. FUNCTION
  212.       In some attributes, there may be object pointers that you need
  213.       to retrieve from that attribute.  On the other hand, somebody else
  214.       might change it at the same time.
  215.  
  216.       This function uses the ShadowBase->sb_strSemaphore to protect the
  217.       access to the objectPtr.  The object that is returned is returned
  218.       Use()'d, so when you are done with the object you should call
  219.       DropObject(object) on it.
  220.  
  221.  
  222. INPUTS
  223.       OBJECT  *objectPtr; - the pointer to the structure element that
  224.                              holds the object pointer you want.
  225. OUTPUTS
  226.       void       *object; - the object that *objectPtr points to.
  227.  
  228. RESULT
  229.  
  230. BUGS
  231.       none known.
  232.  
  233. NOTES
  234.  
  235. SEE ALSO
  236.       SetObject()
  237.  
  238. NAME
  239.       HandleMessages -- Handle all incoming SHADOW messages, return when
  240.                          ^C is hit.
  241.  
  242. SYNOPSIS
  243.       HandleMessages( struct Task *task )
  244.  
  245. FUNCTION
  246.       Handle all incoming messages in the ATTR_JAZZPROCESS' jp_port and
  247.       jp_replyPort, and return when a ^C is sensed.
  248.  
  249.       In order to correctly Wait for ^C, when a Signal is detected, all
  250.       messages are first added to a list, then all the message are
  251.       handled by taking them off the list and calling either
  252.       ParseJazzMethod (for jp_port) or JunkIPCMessage (for jp_replyPort).
  253.  
  254.  
  255. INPUTS
  256.       struct Task  *task; - optional current task pointer.  If NULL, then
  257.                              function calls FindTask(NULL).
  258.  
  259. OUTPUTS
  260.  
  261. RESULT
  262.       When the function returns, there was a ^C sensed.
  263.  
  264. BUGS
  265.       none known.
  266.  
  267. NOTES
  268.  
  269. SEE ALSO
  270.       ParseJazzMessage()
  271.       JunkIPCMessage()
  272.  
  273. NAME
  274.       PSemString -- used to ensure single-thread startup.
  275.  
  276. SYNOPSIS
  277.       PSemString( char  *string, long semFlags )
  278.  
  279. FUNCTION
  280.       Does the following:
  281.          PSem(UseString(string), semFlags);
  282.  
  283.       The SWRI examples uses this function to ensure that only a single
  284.       copy of the executable is running.
  285.  
  286.  
  287. INPUTS
  288.       char     *string; - the system string equivalent which is used to
  289.                            semaphore thread startup.
  290.       long    semFlags; - the flags to send to PSem().
  291.  
  292. OUTPUTS
  293.       none.
  294.  
  295. RESULT
  296.  
  297. BUGS
  298.       none known.
  299.  
  300. NOTES
  301.  
  302. SEE ALSO
  303.       VSemString()
  304.       PSem()/VSem()
  305.  
  306. NAME
  307.       RemoveObject -- send a METHOD_META_REMOVE to an object.
  308.  
  309. SYNOPSIS
  310.       RemoveObject( OBJECT object )
  311.  
  312. FUNCTION
  313.       Does a:
  314.          DoJazzMethod(object, NULL, METHOD_META_REMOVE, METHOD_END);
  315.  
  316. INPUTS
  317.       OBJECT      object; - the object to send the Remove method to.
  318.  
  319. OUTPUTS
  320.       none.
  321.  
  322. RESULT
  323.  
  324. BUGS
  325.       none known.
  326.  
  327. NOTES
  328.  
  329. SEE ALSO
  330.       CreateInstance()
  331.       CreateSubClass()
  332.  
  333. NAME
  334.       SetObject -- Semaphored access to an object in a public area.
  335.  
  336. SYNOPSIS
  337.       oldObject = GetObject( OBJECT *objectPtr , OBJECT newObject )
  338.          d0
  339.  
  340. FUNCTION
  341.       In some attributes, there may be object pointers that you need
  342.       to change in that attribute.  On the other hand, somebody else
  343.       might retrieve it at the same time.
  344.  
  345.       This function uses the ShadowBase->sb_strSemaphore to protect the
  346.       access to the objectPtr.  The object that is returned is returned
  347.       Use()'d, so when you are done with the object you should call
  348.       DropObject(object) on it.  The old value that was stored at the
  349.       objectPtr address is returned as oldObject and replaced by
  350.       newObject.
  351.  
  352.       The newObject is TRANSFERRED to the address, so if you want to
  353.       maintain a valid pointer in newObject when GetObject() returns,
  354.       call this function like this:
  355.  
  356.          oldObject = GetObject(objectPtr, UseObject(newObject));
  357.  
  358.       If you don't care about the returned object, you should call the
  359.       function like this:
  360.          DropObject(GetObject(objectPtr, newObject));
  361.  
  362.  
  363. INPUTS
  364.       OBJECT  *objectPtr; - the pointer to the structure element that
  365.                              holds the object pointer you want.
  366.       OBJECT   newObject; - object to transfer into the objectPtr.
  367.  
  368. OUTPUTS
  369.       void       *object; - the object that *objectPtr points to.
  370.  
  371. RESULT
  372.  
  373. BUGS
  374.       none known.
  375.  
  376. NOTES
  377.  
  378. SEE ALSO
  379.       GetObject()
  380.  
  381. NAME
  382.       SprintfCallback -- sprintf callback for RawDoFmt.  [shadow.lib]
  383.  
  384. SYNOPSIS
  385.       SprintfCallback(c, text);
  386.                       d0  a3
  387. FUNCTION
  388.       This function performs the parsing RawDoFmt requires for
  389.       an sprintf() type function.
  390.  
  391.  
  392. INPUTS
  393.       char     c; - the character to insert
  394.       char *text; - the string to insert it into.
  395.  
  396. OUTPUTS
  397.       a3 pointer is incremented
  398.  
  399.  
  400. RESULT
  401.  
  402. BUGS
  403.       none known.
  404.  
  405. NOTES
  406.  
  407. SEE ALSO
  408.  
  409. NAME
  410.       VSemString -- used to ensure single-thread startup.
  411.  
  412. SYNOPSIS
  413.       VSemString( char  *string )
  414.  
  415. FUNCTION
  416.       Does the following:
  417.          VSem(FindString(string), semFlags);
  418.          DropString(string);
  419.  
  420.       The SWRI examples uses this function to ensure that only a single
  421.       copy of the executable is running.
  422.  
  423.  
  424. INPUTS
  425.       char     *string; - the system string equivalent which is used to
  426.                            semaphore thread startup.
  427.  
  428. OUTPUTS
  429.       none.
  430.  
  431. RESULT
  432.  
  433. BUGS
  434.       none known.
  435.  
  436. NOTES
  437.  
  438. SEE ALSO
  439.       PSemString()
  440.       PSem()/VSem()
  441.